package demo428;

import java.util.Scanner;

public class Yuangong {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 1. 显示欢迎界面和可供选择的菜单项
        System.out.println("欢迎使用工资管理系统！");
        System.out.println("1. 录入职工信息及工资");
        System.out.print("请输入菜单编号: ");
        String menuChoice = scanner.nextLine();

        // 2. 接收菜单编号，并且判断是否合法
        while (!"1".equals(menuChoice)) {
            System.out.println("无效的菜单编号，请重新输入。");
            System.out.print("请输入菜单编号: ");
            menuChoice = scanner.nextLine();
        }

        // 3. 接收职工个人信息
        System.out.print("请输入职工姓名: ");
        String employeeName = scanner.nextLine();
        System.out.print("请输入职工工号: ");
        String employeeId = scanner.nextLine();

        // 4. 接收职工工资信息
        System.out.print("请输入基本工资: ");
        double basicSalary = scanner.nextDouble();
        System.out.print("请输入奖金: ");
        double bonus = scanner.nextDouble();
        System.out.print("请输入扣除项: ");
        double deduction = scanner.nextDouble();

        // 5. 计算工资并且显示
        double totalSalary = basicSalary + bonus - deduction;
        System.out.println("职工 " + employeeName + "（工号：" + employeeId + "）的工资为: " + totalSalary);

        scanner.close();
    }
}
